<!--  -->
<template>
  <div
    class="system-list"
    v-loading="globalLoading"
  >
    <div class="noticeShowM">
      <p>
        属性设置用于管理信息系统对外显示的内容字段
      </p>
    </div>
    <TipTotal :title="(system.name?system.name+'-':'')+'属性设置'">
      <div style="float:left;">
        <OperateInformationAttributeList :resetData="resetData" :system='system' />
      </div>
      <template slot="total">
        <p class="totalR" v-if="total">属性总数：{{total}}</p>
      </template>
    </TipTotal>
    <!-- 列表数据 -->
    <DataTable ref="informationAttrDataTable" :dataTotal='dataTotal' :system='system' />
    <div style="height: 18px;"></div>
  </div>
</template>

<script>
import TipColla from '@/components/common/TipColla.vue'
import TipTotal from '@/components/common/TipTotal.vue'
import OperateInformationAttributeList from '@/components/main/user/system/informationAttribute/OperateInformationAttributeList.vue'
import DataTable from '@/components/main/user/system/informationAttribute/DataTable.vue'
import { mapGetters } from 'vuex'
export default {
  created () {
    let query = this.$route.query
    if (query && query.sid) {
      this.systemId = query.sid
    }
    if (!this.systemId) {
      this.globalLoading = false
      return
    }
    // 获取系统信息
    this.$post('/system/info', { id: this.systemId }).then((resoponse) => {
      this.system = resoponse
      this.globalLoading = false
      this.$store.dispatch('navPrependNameByPath', { prependName: this.system.name + '-', path: this.$route.fullPath })
    })
  },
  data () {
    return {
      globalLoading: true,
      systemId: 0,
      total: 0,
      // 当前的系统
      system: {}
    }
  },
  computed: {
    ...mapGetters([
      'currentSite'
    ])
  },
  components: {
    TipColla,
    TipTotal,
    OperateInformationAttributeList,
    DataTable
  },
  methods: {
    dataTotal (total) {
      this.total = '' + total
    },
    resetData () {
      this.$refs['informationAttrDataTable'].resetData()
    }
  }
}

</script>

<style scoped lang="scss">
.noticeShowM {
  border-left: 4px solid #409EFF;
  padding: 15px;
  font-size: 13px;
  line-height: 1.7;
  background: #F0F8FF;
  margin-bottom: 20px;
}
.totalR {
  float:right;
  margin-right:8px;
  margin-top:6px;
  font-size: 14px;
  color:#666;
}
</style>
